﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="frmRequisitoProjeto.ascx.cs" Inherits="QFD.View.RequisitoProjeto.frmRequisitoProjeto" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>

<ext:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
</ext:ScriptManagerProxy>

<script type="text/javascript">
    var abreTelaRequisitoProjeto = function() {
    var WinFrmRequisitoProjeto = <%= WinFrmRequisitoProjeto.ClientID %>;
        WinFrmRequisitoProjeto.show();
    }
</script>

<ext:Window ID="WinFrmRequisitoProjeto" runat="server" Collapsible="false" Icon="UserAdd" Title="Cadastro de Requisitos de projeto" ShowOnLoad="false" Width="400" Height="350" Resizable="false">
<TopBar>
        <ext:Toolbar ID="ToolBar1" runat="server">
            <Items>
                <ext:ToolbarButton ID="btnSave" Icon="Disk" runat="server">
                    <ToolTips>
                        <ext:ToolTip ID="ToolTip1" runat="server" Title="Salvar requisito de projeto">
                        </ext:ToolTip>
                    </ToolTips>
                    <AjaxEvents>
                        <Click OnEvent="SaveRequisitoProjeto" Before="var valid= #{StatusForm}.getForm().isValid(); if(valid){#{FormStatusBar}.showBusy('Aguarde...');} return valid;">
                            <EventMask ShowMask="true" MinDelay="1000" Target="CustomTarget" CustomTarget="={#{StatusForm}.getEl()}" />
                        </Click>
                    </AjaxEvents>
                </ext:ToolbarButton>
                <ext:ToolbarSeparator ID="ToolbarSeparator1" runat="server" />
                <ext:ToolbarButton ID="btnClose" runat="server" Icon="DoorIn">
                    <Listeners>
                        <Click Handler="#{WinFrmRequisitoProjeto}.hide(null);" />
                    </Listeners>
                    <AjaxEvents>
                        <Click OnEvent="CloseRequisitoProjeto" />
                    </AjaxEvents>
                </ext:ToolbarButton>
            </Items>
        </ext:Toolbar>
    </TopBar>

    <Body>
    <ext:Hidden ID="txt_CDRequisitoProjeto" runat="server"></ext:Hidden>

        <ext:Store ID="StoreCarregaProjeto" runat="server" OnRefreshData="Refresh" RefreshAfterSaving="Auto">
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="CDPROJETO" />
                        <ext:RecordField Name="NMPROJETO" />
                        <ext:RecordField Name="DSPROJETO" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
        
        <ext:Store ID="StoreRequisitosProjeto" runat="server" OnRefreshData="Refresh" RefreshAfterSaving="Auto">
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="CDREQUISITO" />
                        <ext:RecordField Name="DSREQUISITO" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>

        <ext:Store ID="StoreMeta" runat="server" OnRefreshData="Refresh" RefreshAfterSaving="Auto">
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="CDMETA" />
                        <ext:RecordField Name="DSMETA" />
                        <ext:RecordField Name="VLMETA" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>

        <ext:FitLayout ID="FitLayout1" runat="server">
            <ext:FormPanel ID="StatusForm" runat="server" LabelWidth="75" Width="350" ButtonAlign="Right"
                Border="false" BodyStyle="padding:10px 10px 0;">
                <Defaults>
                    <ext:Parameter Name="Anchor" Value="95%" />
                    <ext:Parameter Name="SelectOnFocus" Value="true" Mode="Raw" />
                    <ext:Parameter Name="MsgTarget" Value="side" />
                    <ext:Parameter Name="LabelSeparator" Value="" />
                </Defaults>

                <Body>
                    <ext:FormLayout ID="FormLayout1" runat="server" LabelAlign="Top">
                        <ext:Anchor>
                            <ext:ComboBox ID="ComboProjeto" FieldLabel="Projeto" StoreID="StoreCarregaProjeto"
                                runat="server" AllowBlank="false" ValueField="CDPROJETO" DisplayField="NMPROJETO"
                                BlankText="É necessário que selecione um projeto" />
                        </ext:Anchor>
                        <ext:Anchor>
                            <ext:ComboBox ID="comboRequisito" FieldLabel="Requisito:" StoreID="StoreRequisitosProjeto"
                                runat="server" AllowBlank="false" ValueField="CDREQUISITO" DisplayField="DSREQUISITO"
                                BlankText="É necessário que selecione um requisito de projeto" />
                        </ext:Anchor>
                        <ext:Anchor>
                            <ext:ComboBox ID="ComboBoxRequisitoPai" FieldLabel="Requisito Pai:" StoreID="StoreRequisitosProjeto"
                                runat="server" AllowBlank="false" ValueField="CDREQUISITO" DisplayField="DSREQUISITO"
                                BlankText="É necessário que selecione um requisito de projeto Pai" >
                                <Items>
                                    <ext:ListItem Text="Nenhum" Value="0"/>
                                </Items>
                                </ext:ComboBox>
                        </ext:Anchor>
                        <ext:Anchor>
                            <ext:Checkbox ID="CheckboxFGCheck" FieldLabel="Último da hierarquia" runat="server"
                                Checked="False">
                                <AjaxEvents>
                                    <Check OnEvent="Check">
                                    </Check>
                                </AjaxEvents>
                            </ext:Checkbox>
                        </ext:Anchor>
                        <ext:Anchor>
                            <ext:ComboBox ID="ComboBoxMeta" FieldLabel="Meta:" Disabled="true" StoreID="StoreMeta" runat="server" AllowBlank="true"
                                ValueField="CDMETA" DisplayField="DSMETA" />
                        </ext:Anchor>
                    </ext:FormLayout>
                </Body>

            </ext:FormPanel>
        </ext:FitLayout>
    </Body>

    <BottomBar>
        <ext:StatusBar ID="FormStatusBar" runat="server" DefaultText="Ready">
            <Plugins>
                <ext:ValidationStatus ID="ValidationStatus1" runat="server" FormPanelID="StatusForm" ValidIcon="Accept" ErrorIcon="Exclamation" />
            </Plugins>
        </ext:StatusBar>
    </BottomBar>
    
</ext:Window>

